# Contributor: Antoine Martin (ayakael) <dev@ayakael.net>
# Maintainer: Antoine Martin (ayakael) <dev@ayakael.net>
pkgname=py3-tika
_pyname="tika"
pkgver=2.6.0
pkgrel=2
# x86 | armv7 | armhf: blocked by openjdk
# riscv64: Unable to start Tika server
# loongarch64: Unable to start Tika server
arch="noarch !riscv64 !x86 !armv7 !armhf !loongarch64"
pkgdesc="Apache Tika Python library"
url="https://pypi.python.org/project/tika"
license="Apache-2.0"
depends="
	py3-requests
"
makedepends="
	py3-setuptools
	py3-gpep517
	py3-wheel
"
checkdepends="
	py3-pytest
	py3-pytest-benchmark
	py3-pytest-cov
	py3-coveralls
	py3-yaml
	openjdk21-jre-headless
"
source="$pkgname-$pkgver-gh.tar.gz::https://github.com/chrismattmann/tika-python/archive/refs/tags/$pkgver.tar.gz"
builddir="$srcdir"/tika-python-$pkgver
subpackages="$pkgname-pyc"

build() {
	gpep517 build-wheel \
		--wheel-dir .dist \
		--output-fd 3 3>&1 >&2
}

check() {
	python3 -m venv --clear --without-pip --system-site-packages .testenv
	.testenv/bin/python3 -m installer .dist/*.whl
	# test_url | test_remote_jpg: urllib.error.HTTPError: HTTP Error 404: Not Found
	.testenv/bin/python3 -m pytest -v -k 'not test_url and not test_remote_jpg'
}

package() {
	python3 -m installer -d "$pkgdir" \
		.dist/*.whl
}

sha512sums="
8182fc9e4905343bac9e00b60fbcc1434559d7b1bdec17b2d32a5e09209efe1734a8858c08fbb19906c747d98351f9a4deceefeb67c5430e4bb481afe7af4e8f  py3-tika-2.6.0-gh.tar.gz
"
